<%-- 
    Document   : view_all_users
    Created on : Mar 14, 2014, 8:26:33 PM
    Author     : ahmed
--%>

<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

        <div>
    <table border="1" id="users">
        <tr>
        <td>ID</td>
        <td>Name</td>
        <td>Email</td>
        <td>Credit Balance</td>
        <td>Job</td>
        <td>Address</td>
        <td>Activation</td>
        </tr>

        <%
            for (Object user : (List) request.getAttribute("viewAllUsers")) {
        %>
        <tr>
            <td><%=((pojo.User) user).getId()%></td>
            <td><%=((pojo.User) user).getName()%></td>
            <td><%=((pojo.User) user).getEmail()%></td>
            <td><%=((pojo.User) user).getCreditBalance()%></td>
            <td><%=((pojo.User) user).getJob()%></td>
            <td><%=((pojo.User) user).getAddress()%></td>
            <td><input id="<%=((pojo.User) user).getId()%>" type="button" value="      <%=((pojo.User) user).isActivated()%>     "></td>
        </tr>
        <%
            }
        %>
    </table>
</div>
    <script type="text/javascript">
            $("input[type=button]").click(function(){
                $.post("Activation", {userId: $(this).attr("id")}, function() {
                    window.history.go(0);
                });
            });
        </script>